$(function() {
	//先把报修日期放进去
	$('#repair_date').val(getNowDate());
	
	var shopData = {
		data: [
			{
				"premises_name":"泰安市奥林匹克花园小区",			//小区名
				"building_num":"01",						//楼号
				"unit":"01",								//单元
				"room_num":"101",							//房间号		
				//"time":"2017-09-01",						//报修时间
				"contacts":"郑飞龙",							//联系人
				"tel":"15688868544",						//联系电话
				"place":"厨房",								//报修地点
				"service_content":"厨房抽油烟机坏了",				//报修内容
				"picture_uri":"图片1"							//图片地址
				
			},
			{
				"premises_name":"华新新干线",
				"building_num":"02",
				"unit":"02",
				"room_num":"202",		
				//"time":"2017-09-04",
				"contacts":"郭祥桥",
				"tel":"13075368656",
				"place":"厕所",
				"service_content":"马桶堵了，不下水",
				"picture_uri":"图片2"
			},
		]
	};
	function shopModal() {
		var self = this;

		self.defaults = {
			activeIndex: 0,
			isAdd: false,
			isAllcheck: false,
			isCancle: true,
			initData: {
				"premises_name":"华新新城",
				"building_num":"00",
				"unit":"00",
				"room_num":"000",		
				//"time":"2010-01-01",
				"contacts":"铃铃铃",
				"tel":"13000000000",
				"place":"卧室",
				"service_content":"床板压断了",
				"picture_uri":"图片0"
			}
		}
		self.listData = ko.observableArray(shopData.data);

		self.line = ko.observable(self.defaults.initData);


		self.lineClick = function(data, e) {
			var lineData = $.extend({}, self.defaults.initData, data);
			self.line(lineData);
			var index = $(e.target).closest("li").index();

			self.defaults.activeIndex = index;
			self.defaults.isAdd = false;
		}
		
	}
	ko.applyBindings(new shopModal());
	
	//验证可否进行支付
	$('#submit').click(function(){
		alert('可以提交保修单！');
	});
	
});
